<!--  -->
<template>
  <el-card>
    <div class="card-header">
      <div class="card-header-l">
        <el-icon><Search /></el-icon>
        <span>筛选搜索</span>
      </div>
      <div>
        <el-button class="button" @click="searchContent = ''">重置</el-button>
        <el-button class="button" type="primary" @click="searchList"
          >查询搜索</el-button
        >
      </div>
    </div>
    <div class="ipt">
      {{ props.title }}
      <el-input v-model.trim="searchContent" :placeholder="props.placeholder" />
    </div>
  </el-card>
</template>

<script lang="ts" setup>
import { ElMessage } from "element-plus";
import { reactive, toRefs, ref } from "vue";
const emit = defineEmits(["search"]);
const props = defineProps({
  title: String,
  placeholder: String,
});

let searchContent = ref("");
const searchList = () => {
  if (!searchContent.value)
    return ElMessage({
      message: "请输入关键词",
      type: "warning",
    });
  emit("search", searchContent);
  searchContent.value = "";
};
</script>
<style lang="scss" scoped>
.card-header {
  display: flex;
  justify-content: space-between;
}

.card-header-l {
  display: flex;
  align-items: center;
  span {
    margin-left: 10px;
    font-size: 14px;
  }
}
.box-card {
  margin: 20px 0;
  .add {
    display: flex;
    justify-content: space-between;
  }
  :deep(.el-card__body) {
    padding: 15px;
  }
}
.ipt {
  display: flex;
  align-items: center;
  font-size: 14px;
  padding: 20px 40px 10px;
  .el-input {
    width: 220px;
    padding-left: 15px;
    height: 30px;
  }
}
</style>
